
const userDao = require("../../dao/userDao");

module.exports= {
     //业务
     //用户登录
    async login(username,pwd){
     return await userDao.getuserbyUserNameAndPwd(username,pwd);
    },
    //注册
    async register(username,pwd){
        //调用dao
       let res=await userDao.getUserbyUserName(username);
       //console.log(res,"aaaa")    
       if(res==null){
          await userDao.insertUser(username,pwd);
          return {"code":1,"msg":"添加成功"} 

       }else{
           return {"code":0,"msg":"添加失败，用户名不能重重复"} 
       }
 } 
}